<template>
  <div>
    <div v-if="Show == 0">
      <div class="mlt">
        <el-form class="demo-form-inline" :inline="true">
          <!-- <el-form-item label="就诊医生">
            <el-input v-model="formInline.user" placeholder="就诊医生" />
          </el-form-item>
          <el-form-item label="就诊科室">
            <el-input v-model="formInline.user" placeholder="就诊科室" />
          </el-form-item>
          <el-form-item label="用户">
            <el-input v-model="formInline.user" placeholder="用户" />
          </el-form-item> -->

          <!-- <el-form-item label="审核">
            <el-select v-model="form.is_check" placeholder="审核">
              <el-option label="未审核" value="N" />
              <el-option label="已审核" value="Y" />
            </el-select>
          </el-form-item> -->
          <!-- <el-form-item>
            <el-button type="primary" @click="init()">查询</el-button>
          </el-form-item> -->
        </el-form>
      </div>
      <el-table :data="tableData" style="width: 100%">
        <el-table-column label="日期" prop="res_date" />
        <el-table-column label="就诊医生" prop="res_user_name" />
        <el-table-column label="模板" prop="case_group_name" />
        <el-table-column label="用户" prop="customer_name" />
        <el-table-column label="审核" prop="is_check_name" />
        <el-table-column label="操作" prop="address">
          <template slot-scope="scoped">
            <el-button type="primary" @click="onSubmit(scoped.row)">
              查看
            </el-button>
          </template>
        </el-table-column>
      </el-table>
      <el-pagination
        v-if="total >= 10"
        background
        layout="prev, pager, next"
        :total="total"
        @current-change="handleCurrentChange"
      />
    </div>
    <div v-if="Show == 1">
      <customerCaseDetail :datas="datas" @go="go" />
    </div>
  </div>
</template>

<script>
  // customerCaseDetail
  import { customerCaseList } from '@/api/caseChecks'

  //
  export default {
    components: {
      CustomerCaseDetail: () => import('./components/addcase.vue'),
    },
    data() {
      return {
        form: {
          page: 1,
          pagesize: 10,
        },
        formInline: {
          user: '',
          region: '',
        },
        total: '',
        Show: 0,
        tableData: [],
        datas: {
          id: '',
        },
      }
    },
    mounted() {
      this.init()
    },
    methods: {
      init() {
        customerCaseList(this.form).then((e) => {
          this.total = e.data.total
          this.tableData = e.data.data
        })
      },
      onSubmit(e) {
        this.datas = e
        this.Show = 1
      },

      go() {
        this.init()
        this.Show = 0
      },
      // 下一页
      handleCurrentChange(val) {
        const _this = this
        _this.form.page = val
        this.init()
      },
    },
  }
</script>

<style></style>
